package com.lagou.controller;

import com.lagou.api.ICodeService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangq on 2021/9/26.
 */
@RestController
@RequestMapping(value = "/code")
public class CodeController {
    @Reference
    ICodeService codeService;

    @GetMapping("/create/{email}")
    public Boolean create(@PathVariable String email) {
        return codeService.create(email);
    }

    @GetMapping("/create/{email}/{code}")
    public Integer validate(@PathVariable String email, @PathVariable String code) {
        return codeService.validate(email, code);
    }
}
